package main

import (
	"github.com/gin-gonic/gin"
	"os"
	"satellite/monitor/data"
	"satellite/monitor/utils"
	"strconv"
)

func main() {
	portStr := os.Getenv("UDP_PORT")
	servicePort := os.Getenv("SERVICE_PORT")
	if servicePort == "" {
		servicePort = "8080"
	}
	port, err := strconv.Atoi(portStr)
	if err != nil {
		panic(err)
	}
	data.InitData()
	go utils.RecvPosition("0.0.0.0", port)
	go utils.RecvConn("0.0.0.0", port+1)
	r := gin.Default()
	register(r)
	err = r.Run("0.0.0.0:" + servicePort)
	if err != nil {
		panic(err)
	}
}
